/*
 * Copyrignt (c) xuzeshui.com. All Rights Reserved.
 * Author: Zengxiaobao Zeng<i@zengxiaobao.com>
 * Created Time: 2015-09-17 12:45:32
 * Last Modified: 2016-09-12 14:36:59
 * File Name: controllers/qdy.go
 * Description:
 */
package controllers

/*
import (
	//	"strconv"
	"encoding/json"
	//	"fmt"
	"time"

	"advertoper/adoper"

	"github.com/astaxie/beego"
	log "github.com/cihub/seelog"
)

type AdOpController struct {
	beego.Controller
}

func (p *AdOpController) GetAdverOper() {
	starttime := time.Now()
	appkey := p.Ctx.Input.Query("appkey")

	resp := make(map[string]interface{})

	defer func() {
		timeend := time.Since(starttime)
		log.Infof("GetAdvertOper, ip: %s, %s %s, appkey: %s, cost: %s, resp:(%d, %s)",
			p.Ctx.Input.IP(), p.Ctx.Input.Method(), p.Ctx.Input.URL(),
			appkey, timeend.String(), resp["code"], resp["msg"])
		p.Ctx.Output.Header("Access-Control-Allow-Origin", "*")
		p.Data["json"] = resp
		p.ServeJSON()
	}()
	body := p.Ctx.Input.RequestBody
	log.Debugf("recv body %s", body)
	reqBody := &adoper.ReqExtraParam{}
	if err := json.Unmarshal(body, reqBody); err != nil {
		resp["code"] = -1
		resp["msg"] = "invalid json body"
		return
	}
	reqBody.AppKey = appkey
	reqBody.ClientIp = p.Ctx.Input.IP()

	if ok, positionInfo := adoper.GetOptionList(reqBody); ok {
		if positionInfo != nil {
			resp["oplist"] = positionInfo
		} else {
			poslist := make([]interface{}, 0)
			resp["oplist"] = poslist
		}
		resp["code"] = 0
		resp["msg"] = "success"
		return
	}
}*/
